<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="/css/shangjia-ued.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/lib/jquery.js"></script>
<script type="text/javascript" src="/js/plugin/form/jquery.form.js"></script>
<script type="text/javascript" src="/js/plugin/validate/jquery.validate.js"></script>
<script type="text/javascript" src="/js/plugin/validate/jquery.validate.addmethod.js"></script>
<script type="text/javascript" src="/js/plugin/validate/jquery.validate.localize.js"></script>


<style type="text/css">
.val_error{color:#f00;}
.val_valid{color:green;}
</style>

</head>
<body>

<div>
<a href="api.html">api</a>
<form method="post" id="demo2" action="#">
<table cellpadding="4" cellspacing="4" border="1">
	<textarea name="validServerError">{"url":"错误"}</textarea>
	<tr><td>用户名</td><td width=200><input type="text" name="username" id="username"/></td><td>验证必填</td></tr>
	<tr><td>数字</td><td><input type="text"  name="number"/></td><td>验证数字</td></tr>
	<tr><td>邮箱</td><td><input type="text"  name="email"/></td><td>验证邮箱</td></tr>
	<tr><td>网站</td><td><input type="text"  name="url"/></td><td>验证网址</td></tr>
	<tr><td>电话</td><td><input type="text"  name="isPhone"/></td><td>验证固话</td></tr>
	<tr><td>手机</td><td><input type="text" name="isMobile"/></td><td>验证手机号</td></tr>
	<tr><td>邮编</td><td><input type="text" name="isZipCode"/></td><td>验证邮编</td></tr>
	<tr><td>test</td><td><input type="text" name="testRule"/></td><td></td></tr>
</table>
<div><input type="submit" value="提交" /></div>
<div id="validErrorBox"></div>
</form>
<script type="text/javascript">
$(function(){
	var form2 = $("#demo2");
	form2.validate({
		groups:{
			phone:"isPhone isMobile"
		},
		rules:{
			username:{
				required:true
			},
			number:{
				number:true
			},
			isPhone:{
				required:true
			},
			isMobile:{
				required:true
			}
		},
		message:{
			username:{
				required:"用户名必填"
			},
			number:{
				number:"数字"
			}
		}
	}).showErrors(getServData(form2));
	
})
</script>

</body>
</html>
